package com.gzhryc.shared_device.common.device.dao.db;

import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Join;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.shared_device.common.device.dao.enums.DeviceUpgradeTaskEnum;

import java.util.Date;

@Table(name="device_upgrade_task")
public class DeviceUpgradeTask {

    @Id
    private Long id;

    @Column(name = "device_sn", notNull = true, note = "设备序列号")
    protected String deviceSn;

    @Column(name = "device_type_id", notNull = true, note = "设备类型")
    protected String deviceTypeId;

    @Column(name = "device_fun_code", notNull = true, note = "设备功能")
    protected String deviceFunCode;

    @Column(name = "device_fun_name", notNull = true, note = "设备功能")
    protected String deviceFunName;

    @Column(name = "version_number", notNull = true, note = "版本号")
    protected String versionNumber;

    @Column(name = "package_path",notNull = true, length = 255, note = "版本号")
    protected String packagePath;

    @Column(name = "package_crc",notNull = true,  length = 16, note = "升级包CRC效验")
    protected String packageCRC;

    @Column(name = "upgrade_date", note = "升级时间")
    protected Date upgradeDate;

    @Column(notNull = true,defVal = "1",note = "升级任务状态")
    protected Integer state;

    @Column(name = "upgrade_process_info", type = "TEXT", note = "升级过程信息")
    protected String upgradeProcessInfo;

    @Column(name = "fail_note",length = 255, note = "升级错误信息")
    protected String failNote;

    @Column(name = "update_date", autoUpdateTime = true, note = "最后修改时间")
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    @Join(fromField = "device_type_id")
    protected DeviceType deviceType;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDeviceSn() {
        return deviceSn;
    }

    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }

    public String getDeviceTypeId() {
        return deviceTypeId;
    }

    public void setDeviceTypeId(String deviceTypeId) {
        this.deviceTypeId = deviceTypeId;
    }

    public String getDeviceFunCode() {
        return deviceFunCode;
    }

    public void setDeviceFunCode(String deviceFunCode) {
        this.deviceFunCode = deviceFunCode;
    }

    public String getDeviceFunName() {
        return deviceFunName;
    }

    public void setDeviceFunName(String deviceFunName) {
        this.deviceFunName = deviceFunName;
    }

    public String getVersionNumber() {
        return versionNumber;
    }

    public void setVersionNumber(String versionNumber) {
        this.versionNumber = versionNumber;
    }

    public String getPackagePath() {
        return packagePath;
    }

    public void setPackagePath(String packagePath) {
        this.packagePath = packagePath;
    }

    public String getPackageCRC() {
        return packageCRC;
    }

    public void setPackageCRC(String packageCRC) {
        this.packageCRC = packageCRC;
    }

    public Date getUpgradeDate() {
        return upgradeDate;
    }

    public void setUpgradeDate(Date upgradeDate) {
        this.upgradeDate = upgradeDate;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getUpgradeProcessInfo() {
        return upgradeProcessInfo;
    }

    public void setUpgradeProcessInfo(String upgradeProcessInfo) {
        this.upgradeProcessInfo = upgradeProcessInfo;
    }

    public String getFailNote() {
        return failNote;
    }

    public void setFailNote(String failNote) {
        this.failNote = failNote;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public DeviceType getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(DeviceType deviceType) {
        this.deviceType = deviceType;
    }

    public String getStateName(){
        return DeviceUpgradeTaskEnum.State.note(this.state);
    }
}
